﻿namespace DualityEngine.Business
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Xna.Framework.Graphics;
    using Microsoft.Xna.Framework;

    public class ResourceManager
    {
        private static ResourceManager instance;
        
        //Vitual Game Parts
        public SpriteBatch spriteBatch;
        public GraphicsDevice graphicsdevice;
        
        //Cursor Types
        public Texture2D fpscursor;
        public Texture2D cursoridle;

        //Spritefonts
        public SpriteFont kootenay;

        //ships
        public Model scoutship;
        public Model engineership;
        public Model rocketship;
        public Model fightership;

        //Planet
        public Model planet;
        public Model astroid;

        //Skybox
        public Model skybox;

        //Login
        public Texture2D loginmenubackground;
        public Texture2D registerbutton;
        public Texture2D registerbuttonhover;
        public Texture2D loginbuttonhover;
        public Texture2D loginbutton;
        public Texture2D logintextbox;
        public Texture2D logintextboxhover;
        public Texture2D nimalogo;

        public static ResourceManager Instance
        {
            get
            {
                if (instance == null)
                    throw new Exception("ResourceManager isn't created yet. Check your SpaceGame.cs Constructor");
                return instance;
            }
        }

        public static void CreateResourceManager(Game spacegame)
        {
            instance = new ResourceManager(spacegame);
        }

        protected ResourceManager(Game spacegame)
        {
            this.graphicsdevice = spacegame.GraphicsDevice;
            spriteBatch = new SpriteBatch(spacegame.GraphicsDevice);

            //3D Objects Loading
            planet = spacegame.Content.Load<Model>("Models\\Planets\\Planet1");
            skybox = spacegame.Content.Load<Model>("Models\\Skybox\\skybox01");
            astroid = spacegame.Content.Load<Model>("Models\\Astroid\\asteroid01");
            scoutship = spacegame.Content.Load<Model>("Models\\Ships\\ship");

            //Cursors
            fpscursor = spacegame.Content.Load<Texture2D>("Textures\\Cursor\\FpsCursor");
            cursoridle = spacegame.Content.Load<Texture2D>("Textures\\Cursor\\CursorIdle");

            //LoginMenu
            loginmenubackground = spacegame.Content.Load<Texture2D>("Textures\\Menu\\LoginMenu\\LoginBackground");
            registerbutton = spacegame.Content.Load<Texture2D>("Textures\\Menu\\LoginMenu\\Controls\\Buttons\\Button_Register");
            registerbuttonhover = spacegame.Content.Load<Texture2D>("Textures\\Menu\\LoginMenu\\Controls\\Buttons\\Button_Register_Highlight");
            loginbuttonhover = spacegame.Content.Load<Texture2D>("Textures\\Menu\\LoginMenu\\Controls\\Buttons\\Button_Login_Highlight");
            loginbutton = spacegame.Content.Load<Texture2D>("Textures\\Menu\\LoginMenu\\Controls\\Buttons\\Button_Login");
            logintextbox = spacegame.Content.Load<Texture2D>("Textures\\Menu\\LoginMenu\\Controls\\Textboxes\\Login_TextBox");
            logintextboxhover = spacegame.Content.Load<Texture2D>("Textures\\Menu\\LoginMenu\\Controls\\Textboxes\\Login_TextBox_Selected");
            nimalogo = spacegame.Content.Load<Texture2D>("Textures\\Menu\\LoginMenu\\Logo-6-2");

            //Spritefonts
            kootenay = spacegame.Content.Load<SpriteFont>("Spritefonts\\kootenay");
        }
    }
}
